# transfer the full version order of points into coordination.
# the count order should be started at (0,0), and increase y first
# 
# Author: Guochun Shen
# Data:   2011-12-20
# Project:spatial statistic
# Email:  shenguochun@gmail.com
###############################################################################

get_xy=function(norder,dimyx){
	xi=norder%/%dimyx[1]
	xi[dimyx[1]*(1:dimyx[2])]=xi[dimyx[1]*(1:dimyx[2])]-1
	xi=xi+1
	yi=norder-(xi-1)*dimyx[1]
	return(matrix(c(xi,yi),ncol=2))
}

